<!-- #section:basics/content.breadcrumbs -->
<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed')
        } catch (e) {
        }
    </script>

    <ul cp="2" class="breadcrumb">
        <li class="active">总览</li>
    </ul>
    <!-- /.breadcrumb -->
</div>

<!-- /section:basics/content.breadcrumbs -->
<div class="page-content">

    <div cp=1 class="container">
        <div id="datatableContainerNewUser" style="width: 80%;height:400px;">
        </div>
        <div id="datatableContainerNewComments" style="width: 80%;height:400px;">
        </div>
        <div id="datatableContainerUser" style="width: 80%;height:400px;">
        </div>
        <div id="datatableContainerBobo" style="width: 80%;height:400px;">
        </div>
    </div>

</div>
<script src="$request.contextPath/res/plugins/echarts.min.js"></script>
<script>

    $(function () {
        /*getDataAndInitTable('./getUserActive', '活跃用户统计', 'datatableContainerUser');
        getDataAndInitTable("./getBoBoActive", '活跃主播统计', 'datatableContainerBobo');
        getDataAndInitTable("./getNewUser", '新增用户统计', 'datatableContainerNewUser');
        getDataAndInitTable("./getNewComment", '新增评论统计', 'datatableContainerNewComments');*/
    })

    function getDataAndInitTable(url, title, el){
        var brands;
        $.ajax({
            url: url,
            type: "POST",
            dataType: 'json',
            data: {
            },
            success: function (datas) {
                var xlabel = '日期';
                var ylabel = '人数';
                var x=[];
                var y=[];
                for (var i in datas) {
                    obj = datas[i];
                    x.push(obj['cntDay']);
                    y.push(obj['cnt']);
                }
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById(el));
                // 指定图表的配置项和数据
                var option = {
                    title: {
                        text: title,
                    },
                    tooltip : {
                        trigger: 'axis'
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis : [
                        {
                            type : 'category',
                            boundaryGap : false,
                            data : x
                        }
                    ],
                    yAxis : [
                        {
                            type : 'value'
                        }
                    ],
                    series : [
                        {
                            name:'总计',
                            type:'line',
                            stack: '当天活跃数',
                            data:y
                        }
                    ]
                };
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);
            },
            error:function(data){
                layer.msg('获取记录失败！', {icon: 5});
            }
        });
    }

</script>